﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SD.Entities;
using SD.IBUS;
using SD.IDAL;
using SD.DAL;
using System.Data.SqlClient;

namespace SD.BUS
{
    public class UserBIZ : BaseBIZ, IUserBIZ
    {
        #region IUserBIZ Members

        /// <summary>
        /// User log in system
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>        
        public User Login(string username, string password)
        {
            IUserDAO userDAO = new UserDAO();
            User user;

            try
            {
                user = userDAO.Login(username, password);
            }
            catch (SqlException ex)
            {
                throw ex;
            }

            return user;
        }

        public User GetByID(string userID)
        {
            IUserDAO userDAO = new UserDAO();
            User user;

            try
            {
                user = userDAO.GetById(userID);
            }
            catch (SqlException ex)
            {
                throw ex;
            }

            return user;
        }

        #endregion
    }
}
